package wechat

import (
	"fitness/pkg/middleware"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

type Mp struct {
	logger  *zap.Logger
	service *MpService
}

func NewMp(logger *zap.Logger, service *MpService) *Mp {
	return &Mp{
		logger:  logger,
		service: service,
	}
}

func (m *Mp) InitApiRouter(engine *gin.Engine) {
	mp := engine.Group("/mp")
	{
		//微信code换用户
		mp.POST("/wxLogin", m.service.WxLogin)
		mp.POST("/userInfo", m.service.WxGetUserInfo)

		//上传头像
		mp.POST("/upload/img", middleware.MpJwt, m.service.UploadAvatar)
		//修改昵称
		mp.POST("/update/nickname", middleware.MpJwt, m.service.Nickname)

		//修改手机号
		mp.POST("/update/phone", middleware.MpJwt, m.service.Phone)
		//获取日期
		mp.GET("/date", m.service.GetDate)
		//获取日期对应的约定详情
		mp.POST("/getCourseList", m.service.GetCourseList)

	}
}
